home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
LANG
/
BASIC
/
LIB
/
EVENTSHELL
/
EXTENSION
/
FontMenu
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1996-01-20
|
8KB
|
175 lines
Module FontMenu
-----------------------------------------------------------------------
FontMenu Handling Routines (version 1.07 29-Dec-95)
This library contains routines that handle the interface to the
FontMenu Relocatable Module by Joris R
ling (version 1.16)
-----------------------------------------------------------------------
Structure of Data used in this module
Public Methods Supported:
FN_shell_FontMenu_Init Initialises module
FNshell_FontMenu_IsInitialised
FNshell_FontMenu_GetHandle
FNshell_FontMenu_OffersSystemFont
FNshell_FontMenu_GetLastSelectedFont
FNshell_FontMenu_GetNrFonts
PROCshell_AttachFontMenu
PROCshell_AttachFontSubMenu
PROCshell_FontMenu_SelectFont
PROCshell_FontMenu_AllowSystemFont
PROCshell_FontMenu_DisallowSystemFont
PROCshell_FontMenu_SelectFont
Responses to events raised by other modules
PROCshell_FontMenu_ShowMenu
PROCshell_FontMenu_Deregister
Private Methods Supported:
PROCshell_FontMenu_Init
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Public routines..
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+"*|Start FN_shell_FontMenu_Init
_shell_FontMenu_Init
Module constants
/$_c_FontMenu_NotDefined% = -1
0._c_FontMenu_SystemFont$ = "SystemFont"
1%_c_FontMenu_MaxNameLength% = 256
2#_c_FontMenu_ValidSelFlag% = 1
4=_c_FontMenu_ErrMess_Create$ = "Unable to create FontMenu"
5A_c_FontMenu_ErrMess_Load$ = "FontMenu module is not loaded"
Module variables
8;_m_FontMenu_Handle% = _c_FontMenu_NotDefined%
9%_m_FontMenu_Initialised% =
:&_m_FontMenu_LastSelectedFont$ = ""
;%_m_FontMenu_NrFontsFound% = 0
<%_m_FontMenu_OfferSystemFont% =
@!*|Stop FN_shell_FontMenu_Init
D'*|Start FNshell_FontMenu_GetNrFonts
shell_FontMenu_GetNrFonts
= _m_FontMenu_NrFontsFound%
H&*|Stop FNshell_FontMenu_GetNrFonts
L.*|Start PROCshell_FontMenu_AllowSystemFont
shell_FontMenu_AllowSystemFont
N$_m_FontMenu_OfferSystemFont% =
shell_FontMenu_SelectFont( _m_FontMenu_LastSelectedFont$ )
R-*|Stop PROCshell_FontMenu_AllowSystemFont
V1*|Start PROCshell_FontMenu_DisallowSystemFont
shell_FontMenu_DisallowSystemFont
X$_m_FontMenu_OfferSystemFont% =
shell_FontMenu_SelectFont( _m_FontMenu_LastSelectedFont$ )
\0*|Stop PROCshell_FontMenu_DisallowSystemFont
`/*|Start FNshell_FontMenu_ContainsSystemFont
shell_FontMenu_OffersSystemFont
b"= _m_FontMenu_OfferSystemFont%
c.*|Stop FNshell_FontMenu_ContainsSystemFont
g$*|Start PROCshell_AttachFontMenu
*|Define Using_FontMenu
shell_AttachFontMenu( wh%, menuic%, display_ic%, sel_fn$, maker_fn$ )
shell_FontMenu_Init
wh% > 0
menuic% >= 0
shell_IconSetButtonType( wh%, menuic%, 3 )
shell_EvntAdd_PopUpMenu(
shell_GetWindowIdentifier( wh% ), menuic%, display_ic%, _POPUP_TYPE_FONTMENU, sel_fn$, maker_fn$, _POPUP_TYPE_FONTMENU )
PROCshell_Tracef0( "AttachFontMenu:Attaching font menu" )
v#*|Stop PROCshell_AttachFontMenu
z'*|Start PROCshell_AttachFontSubMenu
*|Define Using_FontMenu
shell_AttachFontSubMenu(item%,warn_fn$,sel_fn$)
itemstart%,menu%,temp%,ctr%
shell_FontMenu_Init
"MenuUtil_SubMenu",item%,_m_FontMenu_Handle%
"MenuUtil_Warning",,
Store menu ptr in shell memory..
!_U%!252 = _m_FontMenu_Handle%
shell_EventListMenuWarn(item%,_m_FontMenu_Handle%,warn_fn$,sel_fn$)
*|ifdef PROCshell_TraceInit
shell_Tracef0("AttachFontSubMenu:Attaching font menu &"+
~_m_FontMenu_Handle% )
*|endif
&*|Stop PROCshell_AttachFontSubMenu
)*|Start PROCshell_FontMenu_SelectFont
shell_FontMenu_SelectFont( fontname$ )
fontname$ = ""
"FontMenu_Select", "" +
( 0 ), _m_FontMenu_OfferSystemFont%
, _m_FontMenu_Handle%
"FontMenu_Select",fontname$, _m_FontMenu_OfferSystemFont%
, _m_FontMenu_Handle%
-_m_FontMenu_LastSelectedFont$ = fontname$
*|ifdef TraceInit
shell_Tracef0("FontMenuSelectFont:Font is '"+fontname$+"'")
*|endif
(*|Stop PROCshell_FontMenu_SelectFont
0*|Start FNshell_FontMenu_GetLastSelectedFont
shell_FontMenu_GetLastSelectedFont
#= _m_FontMenu_LastSelectedFont$
/*|Stop FNshell_FontMenu_GetLastSelectedFont
**|Start FNshell_FontMenu_IsInitialised
shell_FontMenu_IsInitialised
= _m_FontMenu_Initialised%
)*|Stop FNshell_FontMenu_IsInitialised
&*|Start FNshell_FontMenu_GetHandle
shell_FontMenu_GetHandle
= _m_FontMenu_Handle%
%*|Stop FNshell_FontMenu_GetHandle
#*|Start FNshell_FontMenu_Decode
shell_FontMenu_Decode( select_block% )
menu_block%, fontmenuflag%, selected_font$
Emenu_block% =
shell_HeapBlockFetch( _c_FontMenu_MaxNameLength% )
"FontMenu_DecodeFontMenu", select_block%, menu_block%
fontmenuflag%
selected_font$ = ""
fontmenuflag% = _c_FontMenu_ValidSelFlag%
sensible selection made..
6 selected_font$ =
shell_GetString( menu_block% )
selected_font$ = ""
0 selected_font$ = _c_FontMenu_SystemFont$
shell_FontMenu_SelectFont( selected_font$ )
Evnts_GetLastMouseButton = _MSE_ADJUSTBUT
_
"Wimp_CreateMenu", ,
shell_MenuLastHandle,
shell_MenuLastXPos,
shell_MenuLastYPos
shell_HeapBlockReturn( menu_block% )
= selected_font$
"*|Stop FNshell_FontMenu_Decode
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Responses to events raised by other modules..
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
)*|Start PROCshell_FontMenu_Deregister
shell_FontMenu_Deregister
Called when application closes down. Allows FontMenu to kill
itself when the number of users falls to zero.
"XFontMenu_Release"
(*|Stop PROCshell_FontMenu_Deregister
'*|Start PROCshell_FontMenu_ShowMenu
shell_FontMenu_ShowMenu( _Q%, _window_handle%, _icon_handle%, popup% )
_m_FontMenu_Initialised% =
shell_FontMenu_Init
shell_HandleMenuOpen( _Q%, _m_FontMenu_Handle%, _window_handle%, _icon_handle%,
&*|Stop PROCshell_FontMenu_ShowMenu
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Private module routines
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#*|Start PROCshell_FontMenu_Init
shell_FontMenu_Init
flags%
_m_FontMenu_Initialised% =
( "RMEnsure FontMenu 1.16 Error " + _c_FontMenu_ErrMess_Load$ )
"XFontMenu_Create"
_m_FontMenu_NrFontsFound%;flags%
flags%
)
99, _c_FontMenu_ErrMess_Create$
[
"FontMenu_Select", "" +
0, _m_FontMenu_OfferSystemFont%
, _m_FontMenu_Handle%
$ _m_FontMenu_Initialised% =
$
shell_ExReg_FontMenu_Loaded
"*|Stop PROCshell_FontMenu_Init